package cn.qu.util;

import java.math.BigDecimal;
import java.util.Date;

public class TypeUtils {

	public static boolean isPojo(Class<?> clazz) {
		return !isSimpleReferenceType(clazz) && !isSimpleType(clazz) && !isDateType(clazz) && !isDecimalType(clazz);
	}

	public static boolean isSimpleType(Class<?> clazz) {
		return clazz.getName() == "int" || clazz.getName() == "float" || clazz.getName() == "short"
				|| clazz.getName() == "double" || clazz.getName() == "byte" || clazz.getName() == "char"
				|| clazz.getName() == "long" || clazz.getName() == "boolean";
	}

	public static boolean isSimpleReferenceType(Class<?> clazz) {
		return clazz == String.class || clazz == Integer.class || clazz == Float.class || clazz == Short.class
				|| clazz == Character.class || clazz == Long.class || clazz == Byte.class || clazz == Double.class
				|| clazz == Boolean.class;
	}

	public static boolean isDateType(Class<?> clazz) {
		return clazz == Date.class;
	}

	public static boolean isDecimalType(Class<?> clazz) {
		return clazz == BigDecimal.class;
	}
	
	public static boolean isVoidType(Class<?> clazz) {
		return clazz == Void.class;
	}

}
